// pages/detail/detail.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    //视频详情
    'videoInfo':[{
        "id":0,
        "videoSrc":"http://192.168.52.128/8miles.mp4",
        "videoTitle":"八英里",
        "author":"天商第一德莱文Cc",
        "playCount":"546万",
        "commentCount":"999+",
        "date":"2020-6-10"
    },
    {
    "id":1,
    "videoSrc":"http://192.168.52.128/泰坦尼克号.mp4",
    "videoTitle":"泰坦尼克号",
    "author":"天商第一德莱文Cc",
    "playCount":"122万",
    "commentCount":"999+",
    "date":"2020-6-10"
},
{
  "id":2,
  "videoSrc":"http://192.168.52.128/肖申克的救赎.mp4",
  "videoTitle":"肖申克的救赎",
  "author":"天商第一德莱文Cc",
  "playCount":"1020万",
  "commentCount":"1w+",
  "date":"2020-6-10"
},
{
  "id":3,
  "videoSrc":"http://192.168.52.128/勇士.mp4",
  "videoTitle":"勇士",
  "author":"天商第一德莱文Cc",
  "playCount":"9万",
  "commentCount":"1w+",
  "date":"2020-6-10"
},
{
  "id":4,
  "videoSrc":"http://192.168.52.128/肖申克的救赎.mp4",
  "videoTitle":"不一样的天空",
  "author":"天商第一德莱文Cc",
  "playCount":"100万",
  "commentCount":"1w+",
  "date":"2020-6-10"
},
/*说唱*/
{
  "id":5,
  "videoSrc":"http://192.168.52.128/eminem - beautiful.mp4",
  "videoTitle":"Beautiful",
  "author":"天商第一德莱文Cc",
  "playCount":"99万",
  "commentCount":"1w+",
  "date":"2020-6-10"
},
{
  "id":6,
  "videoSrc":"http://192.168.52.128/loseyourself.mp4",
  "videoTitle":"Loseyourself",
  "author":"天商第一德莱文Cc",
  "playCount":"102万",
  "commentCount":"10w+",
  "date":"2020-6-10"
},
{
  "id":7,
  "videoSrc":"http://192.168.52.128/withoutme.mp4",
  "videoTitle":"Withoutme",
  "author":"天商第一德莱文Cc",
  "playCount":"99万",
  "commentCount":"1w+",
  "date":"2020-6-10"
},
{
  "id":8,
  "videoSrc":"http://192.168.52.128/eminem - rain man 现场版 中英字幕.mp4",
  "videoTitle":"Rainman 雨人Cc",
  "author":"天商第一德莱文Cc",
  "playCount":"99万",
  "commentCount":"1w+",
  "date":"2020-6-10"
},
{
  "id":9,
  "videoSrc":"http://192.168.52.128/the monster.mp4",
  "videoTitle":"Themonster",
  "author":"天商第一德莱文Cc",
  "playCount":"1000万",
  "commentCount":"100w+",
  "date":"2020-6-10"
},
/*rock*/
{
  "id":10,
  "videoSrc":"http://192.168.52.128/新裤子 - 别再问我什么是迪斯科 -.mp4",
  "videoTitle":"别再问我什么是迪斯科",
  "author":"天商第一德莱文Cc",
  "playCount":"99万",
  "commentCount":"1w+",
  "date":"2020-6-11"
},
{
  "id":11,
  "videoSrc":"http://192.168.52.128/你要跳舞吗.mp4",
  "videoTitle":"你要跳舞吗",
  "author":"天商第一德莱文Cc",
  "playCount":"101万",
  "commentCount":"10w+",
  "date":"2020-6-11"
},
{
  "id":12,
  "videoSrc":"http://192.168.52.128/新裤子 - 生活因你而火热 (live).mp4",
  "videoTitle":"生活因你而火热",
  "author":"天商第一德莱文Cc",
  "playCount":"92万",
  "commentCount":"1w+",
  "date":"2020-6-11"
},
{
  "id":13,
  "videoSrc":"http://192.168.52.128/gala乐队 - 追梦赤子心.mp4",
  "videoTitle":"追梦赤子心",
  "author":"天商第一德莱文Cc",
  "playCount":"10亿",
  "commentCount":"1000w+",
  "date":"2020-6-11"
},
{
  "id":14,
  "videoSrc":"http://192.168.52.128/young for you.mp4",
  "videoTitle":"Young for u",
  "author":"天商第一德莱文Cc",
  "playCount":"1000亿",
  "commentCount":"10亿+",
  "date":"2020-6-11" 
},  
{
  "id":15,
  "videoSrc":"http://192.168.52.128/you're beautiful.mp4",
  "videoTitle":"U are beautiful,Gril",
  "author":"天商第一德莱文Cc",
  "playCount":"9999万",
  "commentCount":"1000w+",
  "date":"2020-6-11" 
} 
],
    //推荐视频
    otherList:[
      {
        "imgSrc": "https://i0.hdslb.com/bfs/archive/cb93f69df4a4b9216d5149dc58d9a2ce9436b697.jpg@320w_200h.webp",
        "duration": "00:06:28",
        "title": "世界上最小的网站！小到只有0.4KB，你信么？【暗物质#1】",
        "playMsg": "20.6",
        "commentCount": " 445"
    },
    {
        "imgSrc": "https://ae01.alicdn.com/kf/H91a812c5a9094690937e5a67d2b9515fd.jpg",
        "duration": "00:02:11",
        "title": "C罗,我心中的最佳",
        "playMsg": "1w",
        "commentCount": " 9999"
    },
    {
        "imgSrc": "https://ae01.alicdn.com/kf/H338cc161eabd4a87a6a8d1664a523cadA.jpg",
        "duration": "00:01:39",
        "title": "呲哩呲哩最火说唱视频！！！",
        "playMsg": "1万亿",
        "commentCount": " 9000万"
    },
    {
        "imgSrc": "https://i1.hdslb.com/bfs/archive/2f1c5bd88f39c2a489ce1a7b2f715a102c2edf15.jpg@320w_200h.webp",
        "duration": "00:01:03",
        "title": "当B站被腾讯收购！会发生什么？",
        "playMsg": "117.8",
        "commentCount": " 4348"
    },
    {
      "imgSrc": "https://ae01.alicdn.com/kf/H96e7225408df43b894097f4f4e4aefecn.jpg",
      "duration": "00:01:03",
      "title": "詹姆斯为'黑人事件'发声，并且穿上了'I can‘t breath 'T-shirt",
      "playMsg": "999",
      "commentCount": " 4348"
  }

    ],
    //评论数据
    commentData:{
      "commentTotalCount":"999+",
      "commentList":[
        {
        "userIconSrc":"https://ae01.alicdn.com/kf/H7779f0a64c8d4a07b175cba6d1850280r.jpg" ,   //用户头像
        "username":"作者:Cc",  //用户名
        "commentInfo":"会越来越努力的，加油加油",//评论信息
        "commentDate":"2021-6-23"  //评论日期
      },
      {
        "userIconSrc":"https://ae01.alicdn.com/kf/He45c5ae1ba0e40a995d93df6bb0a4d60J.jpg ",   //用户头像
        "username":"C罗",  //用户名
        "commentInfo":"我心中的世界最佳",//评论信息
        "commentDate":"2020-3-10"  //评论日期
      },
      {
        "userIconSrc":"https://ae01.alicdn.com/kf/Hca074c6e38824a0497f8badc2ca82b38P.jpg" ,   //用户头像
        "username":"詹姆斯",  //用户名
        "commentInfo":"tocutoseday,视频真给力，man",//评论信息
        "commentDate":"2020-4-10"  //评论日期
      },
      {
        "userIconSrc":"https://ae01.alicdn.com/kf/Hafb64d36f6d744d38fe1c4ac0bb78e26n.jpg" ,   //用户头像
        "username":"库里",  //用户名
        "commentInfo":"三分王也被你创作的优美视频所吸引",//评论信息
        "commentDate":"2020-5-20"  //评论日期
      },
      {
        "userIconSrc":"https://ae01.alicdn.com/kf/H35f0a42b0fe84029975ac47c6df3a7bcP.jpg" ,   //用户头像
        "username":"Eminem",  //用户名
        "commentInfo":"God，man，加油，会越来越好的，即使扑街，也没关系",//评论信息
        "commentDate":"2020-6-20"  //评论日期
      }
    ]
    } 
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
     let videoId=options.id;
    this. getCurrentVideo(videoId);
    this.getOtherList();
    this.getCommentList();
  },
  /**
   * 获取视频详情,根据页面点击视频的id
   */
  getCurrentVideo(videoId){
    console.log(this.data.videoInfo[videoId]);
     this.setData({
       'videoInfo':this.data.videoInfo[videoId]
     })
     /** 
      let that=this;
       wx.request({
         url: 'http://mock-api.com/mnEe4VnJ.mock/videoDetail?id='+videoId,
         success(res){
            //console.log(res);
            that.setData({
               videoInfo:res.data.data.videoInfo
            })
         }
       })
      */
  },
  /*获取推荐视频*/
  getOtherList(){
    this.setData({
      otherList:this.data.otherList
    })
     
  },
  /*获取评论数据*/
getCommentList(){
  this.setData({
    commentData:this.data.commentData
  })

},
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})